/*
 * 枚举
 */
//////白名单状态
const whiteStatus = [{ 
  code : 1,
  name : '启用',
},
{ 
  code : 2,
  name : '禁用',
}];
const getwhiteStatus = (val) => {
  let re = '';
  whiteStatus.forEach(function(obj) {
    if (obj.code == val) {
      re = obj.name;
      return
    }
  });
  return re
};

//状态
const status = [{ 
  code : 0,
  name : '待付款',
},
{ 
  code : 1,
  name : '已收款 ',
},
{ 
  code : 2,
  name : '已取消',
},
{ 
  code : 3,
  name : '失败',
},
{ 
  code : 4,
  name : '成功',
},
{ 
  code : 5,
  name : '强制放行',
}];

const getStatus = (val) => {
  let re = '';
  status.forEach(function(obj) {
    if (obj.code == val) {
      re = obj.name;
      return
    }
  });
  return re
};
////////支付类型
const payType = [{ 
  code : 1,
  name : '支付宝',
},
{ 
  code : 2,
  name : '微信',
}];
const getpayType = (val) => {
  let re = '';
  payType.forEach(function(obj) {
    if (obj.code == val) {
      re = obj.name;
      return
    }
  });
  return re
};
////////支付状态
const payStatus = [
  {
   code : 0,
   name : '待付款'
  },
  {
    code : 1,
    name : '已付款'
  }
];
const getpayStatus = (val) => {
  let re = '';
  payStatus.forEach(function(obj) {
    if (obj.code == val) {
      re = obj.name;
      return
    }
  });
  return re
};
///////业务类型
const busType = [
  {
    code : 1,
    name : '买入'
  },
  {
    code : 2,
    name : '卖出'
  },
  {
    code : 3,
    name : '冻结'
  },
  {
    code : 4,
    name : '解冻'
  }
];
const getbusType = (val) => {
  let re = '';
  busType.forEach(function(obj) {
    if (obj.code == val) {
      re = obj.name;
      return
    }
  });
  return re
};
////////////操作类型
const handleType = [
  {
    code : 1,
    name : '默认'
  },
  {
    code : 2,
    name : '后台'
  }
];
const gethandleType = (val) => {
  let re = '';
  handleType.forEach(function(obj) {
    if (obj.code == val) {
      re = obj.name;
      return
    }
  });
  return re
};
/////////审核状态
const applyStatus = [
  {
    code : '0',
    name : '待审核'
  },
  {
    code : '1',
    name : '审核'
  },
  {
    code : '2',
    name : '拒绝'
  }
];
const getapplyStatus = (val) => {
  let re = '';
  applyStatus.forEach(function(obj) {
    if (obj.code == val) {
      re = obj.name;
      return
    }
  });
  return re
};
/////////收款方式
const collectionMethod = [
  {
    code : 1,
    name : '支付宝'
  },
  {
    code : 2,
    name : '微信'
  },
  {
    code : 3,
    name : '银行卡'
  }
];
const getcollectionMethod = (val) => {
  let re = '';
  collectionMethod.forEach(function(obj) {
    if (obj.code == val) {
      re = obj.name;
      return
    }
  });
  return re
};




let Enum = {
  status,
  getStatus,
  payType,
  getpayType,
  payStatus,
  getpayStatus,
  whiteStatus ,
  getwhiteStatus,
  busType,
  getbusType,
  handleType,
  gethandleType,
  applyStatus,
  getapplyStatus,
  collectionMethod,
  getcollectionMethod,
};

export default Enum
